using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameStateManagement;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Input;

namespace GameStateManagementSample.Screens
{
    class BGScreen : GameScreen
    {
        #region Fields
        ContentManager m_Content;
        Texture2D m_SBack;
        
#endregion
#region Initialization
        public BGScreen()
        {
            TransitionOnTime = TimeSpan.FromSeconds(0.5f);
            TransitionOffTime = TimeSpan.FromSeconds(0.5f);
            
        }
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (m_Content == null)
                {
                    m_Content = new ContentManager(ScreenManager.Game.Services, "Content");
                    ScreenManager.Game.ResetElapsedTime();
                    m_SBack = m_Content.Load<Texture2D>("Image/bg");

                    
                }
            }
        }
        public override void Deactivate()
        {
            base.Deactivate();
        }
        public override void Unload()
        {
            base.Unload();
        }
#endregion
#region Update and Draw
        protected virtual void OnCancel() 
        {
            
        }
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, false);
        }
        public override void HandleInput(Microsoft.Xna.Framework.GameTime gameTime, InputState input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
           
        }
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin();
            spriteBatch.Draw(m_SBack, Vector2.Zero, Color.White * TransitionAlpha);            
            spriteBatch.End();
        }
#endregion
    }
}
